<template>
    <div class="cov-container">
        <el-row>
            <el-col :span="24">
                <div class="cov-header"></div>
            </el-col>
        </el-row>

        <el-row>
            <el-col :span="24">
                <div class="cov-hotspot">
                    <i></i>
                    <img alt src="../assets/img/icon_cov_hotspot.png">
                    <p class="cov-look-more">
                        <span>
                            查看更多
                            <img alt src="../assets/img/icon_blue_right.png">
                        </span>
                    </p>
                </div>

                <div class="cov-title" v-for="item in covList">
                    <div class="cov-text">
                        <div class="cov-text-box">
                            <div class="cov-new">最新</div>
                            <span>{{ item.title }}</span>
                        </div>
                    </div>
                    <div class="icon-right">
                        <img alt src="../assets/img/icon_right.png">
                    </div>
                </div>

            </el-col>
        </el-row>

        <el-row>
            <el-col :span="24">
                <div class="cov-btn">
                    <template v-for="item in covIconList" :key="item.id">
                        <div class="cov-icon">
                            <div class="cov-a">
                                <img alt :src="item.url">
                                <span>{{ item.text }}</span>
                            </div>
                        </div>
                    </template>
                </div>
            </el-col>
        </el-row>

    </div>
</template>

<script>
    export default {
        name: "Index",
        data() {
            return {
                covIconList: [],
                covList: [],
            }
        },
        created() {
            this.setIconList()
            this.covList = [
                {
                    title: '东京 | 昨日新增本土确诊病例1例'
                },
                {
                    title: '西京 | 昨日新增本土确诊病例2例'
                },
                {
                    title: '南京 | 昨日新增本土确诊病例3例'
                },
                {
                    title: '北京 | 昨日新增本土确诊病例4例'
                },
                {
                    title: '中京 | 昨日新增本土确诊病例5例'
                }
            ];
        },
        methods: {
            // 渲染导航菜单
            setIconList() {
                this.covIconList = [
                    {id: 112, url: require('@/assets/img/icon_inquiry.png'), text: '问医生'},
                    {id: 223, url: require('@/assets/img/icon_check.png'), text: '核酸检测'},
                    {id: 334, url: require('@/assets/img/icon_material.png'), text: '防疫物资'},
                    {id: 445, url: require('@/assets/img/icon_travel.png'), text: '出行政策'},
                ]
            }
        }
    }
</script>

<style lang="scss" scoped>
  .cov-header {
    position: relative;
    width: 100%;
    padding-top: 30.7%;
    color: #fff;
    background: url("../assets/img/header_bg.png") top;
    background-size: cover;
  }

  .cov-hotspot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-weight: 500;
    font-size: 20px;
    line-height: 10px;
    background: #fff;
    margin: 10px;

    i {
      position: relative;
      margin: 10px;
      width: 5px;
      height: 20px;
      background: #4169e2;
    }

    img {
      position: relative;
      margin: 5px;
      width: 90px;
      height: 30px;
    }

    .cov-look-more span:hover {
      text-decoration: underline;
      cursor: pointer;
    }

    .cov-look-more {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      width: 100%;
      color: #4169e2;
      font-weight: 500;
      font-size: 16px !important;
      background-color: #fff;

      span {
        position: relative;
        display: flex;
        align-items: center;
        padding-left: 5px;
        line-height: 5px;
        text-align: center;

        img {
          display: table-cell;
          vertical-align: middle;
          text-align: center;
          width: 18px;
          height: 18px;
        }
      }
    }
  }

  .cov-text {
    flex-grow: 1;
    margin: 3px 0;
  }

  .cov-title {
    display: flex;
    align-items: center;
    color: #1a1a1a;
    font-size: 18px;
    white-space: nowrap;
    line-height: 30px;
    margin: 15px 15px;
    background-color: #fff;

    .cov-text-box {
      display: -webkit-box;
      overflow: hidden;
      text-overflow: ellipsis;
      word-break: break-all;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;

      .cov-new {
        display: inline-block;
        margin-right: 10px;
        padding: 0 3px;
        color: #fff;
        font-weight: 500;
        text-align: center;
        vertical-align: top;
        border-radius: 5px;
        background-color: #f74c31;
      }
    }

    .icon-right {
      flex-shrink: 0;
      margin-left: 8px;

      img {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        width: 18px;
        height: 18px;
      }
    }
  }

  .cov-btn {
    position: relative;
    display: flex;
    padding: 3px 0 20px 0;
    justify-content: space-between;
    height: 115px;
    text-align: center;
    background-color: #f7f7f7;
    border-radius: 10px 10px 0 0;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;

    .cov-icon {
      position: relative;
      display: flex;
      flex-direction: column;
      flex-grow: 1;
      align-items: center;
      justify-content: center;
      width: 25%;
      background-color: #fff;

      .cov-a {
        cursor: pointer;
      }

      img {
        display: block;
        width: 51px;
        height: 51px;
        object-fit: cover;
      }

      span {
        color: #333;
        font-weight: 500;
        font-size: 12px;
        line-height: 1.15;
      }
    }

  }
</style>
